<template>
<!--  /login?redirect=%2Findex-->
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="商品名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入商品名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="品牌信息" prop="brand">
        <el-input
          v-model="queryParams.brand"
          placeholder="请输入品牌信息"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="商品状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择商品状态" clearable>
          <el-option
            v-for="dict in dict.type.sys_normal_disable"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="搜索关键字" prop="keywords">
        <el-input
          v-model="queryParams.keywords"
          placeholder="请输入搜索关键字"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['product:info:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['product:info:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['product:info:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['product:info:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="编号" align="center" prop="id" >
        <template slot-scope="scope">
          {{scope.$index+1}}
        </template>
      </el-table-column>
      <el-table-column label="商品名称" align="center" prop="name" />
      <el-table-column label="商品类型" align="center" prop="typeName" />
      <el-table-column label="商品主图" align="center" prop="img" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.img" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="商品轮播图" align="center" prop="carouselImages" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.carouselImages" :width="50" :height="50"/>
        </template>
      </el-table-column>
      <el-table-column label="商品评论数" align="center" prop="commentCount" />
      <el-table-column label="商品收藏人气" align="center" prop="collectCount" />
      <el-table-column label="品牌信息" align="center" prop="brandName" />
      <el-table-column label="商品状态" align="center" prop="status">
        <template slot-scope="scope">
        <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
          <el-switch
            v-model="scope.row.status"
            active-color="#13ce66"
            inactive-color="#ff4949"
            active-value="0"
            inactive-value="1"
            @change="productStatus(scope.row)"
          >
          </el-switch>
        </template>
      </el-table-column>
      <el-table-column label="单位" align="center" prop="unit" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['product:info:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['product:info:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改商品信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="70%" append-to-body>
      <el-steps :active="active" finish-status="success">
        <el-step title="基本信息"></el-step>
        <el-step title="規格信息"></el-step>
        <el-step title="商品描述"></el-step>
      </el-steps>
<!--      基本信息-->
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <div v-show="active ==0">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="商品名称" prop="name">
              <el-input v-model="form.name" placeholder="请输入商品名称" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="搜索关键字" prop="keywords" label-width="100px">
              <el-input v-model="form.keywords" placeholder="请输入搜索关键字"  />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="单位" prop="unit">
              <el-input v-model="form.unit" placeholder="请输入单位" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="商品状态" prop="status">
              <el-radio-group v-model="form.status">
                <el-radio
                  v-for="dict in dict.type.sys_normal_disable"
                  :key="dict.value"
                  :label="dict.value"
                >{{dict.label}}
                </el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="商品类型" prop="type">
                <el-cascader
                  v-model="productTypeIds"
                  :options="productTypeListTree"
                  :props="{ label: `name` ,value:`id` }"
                  @change="changeProductTypeIds">
                </el-cascader>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="商品品牌" prop="brand">
              <el-select v-model="form.brand" style="width: 100%">
              <el-option
                v-for="brand in productBrandList"
                :key="brand.id"
                :label="brand.name"
                :value="brand.id">
              </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="商品主图" prop="img">
          <image-upload v-model="form.img"/>
        </el-form-item>
        <el-form-item label="商品轮播图" prop="carouselImages">
          <image-upload v-model="form.carouselImages"/>
        </el-form-item>
        </div>

        <div v-show="active == 1">
          <el-form-item label="规格信息" prop="ruleAttrId">
            <el-select v-model="form.ruleAttrId" placeholder="请选择" style="white:100%" @change="changeRule">
              <el-option
                v-for="item in productRuleList"
                :key="item.id"
                :label="item.name"
                :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>

          <el-row>
            <el-form :inline="true" :model="uniteSkuForm" class="demo-form-inline">
            <el-col v-for="tableColumn in tableColumnListTemplate" :span="24/tableColumnListTemplate.length">
              <el-form-item :label="tableColumn.label">
                <el-input-number v-if="tableColumn.prop !='image'" v-model="uniteSkuForm[tableColumn.prop]"
                                 :precision="2" :step="0.5" :max="999999"
                                 :min="0"
                                 size="small">
                </el-input-number>
                <image-upload v-if="tableColumn.prop=='image'" v-model="uniteSkuForm[tableColumn.prop]"
                              :isShowTip.default="false"
                              :limit.dedault="1"
                              class="custom-image-uploader2"/>
              </el-form-item>
            </el-col>
            <el-col :span="5" :offset="20">
              <el-form-item>
                <el-button type="primary" @click="clickSettings">一键设置</el-button>
                <el-button type="primary" @click="clearSettings">一键清空</el-button>
              </el-form-item>
            </el-col>
          </el-form>
          </el-row>

          <el-row :span="24">
            <el-col :span="24">
              <el-table v-loading="loading" :data="tableBodyList" height="300px" @selection-change="handleSelectionChange">
                <el-table-column v-for="column in tableColumnList" :label="column.label"
                                 align="center" :prop="column.prop">
                  <template slot-scope="scope">
                    <span v-if="column.prop.indexOf('prop') > -1 || column.prop == 'number'" >{{scope.row[column.prop]}}</span>
                    <el-input v-if="column.prop.indexOf('prop') == -1 && column.prop != 'image' && column.prop != 'number' " v-model="scope.row[column.prop]"></el-input>
                    <image-upload v-if="column.prop=='image'" v-model="scope.row[column.prop]"
                                  :isShowTip.default="false"
                                  :limit.dedault="1"
                                  class="custom-image-uploader"/>
                  </template>
                </el-table-column>
                <el-table-column label="操作">
                  <template slot-scope="scope">
                    <el-button type="danger"  v-if="scope.row.stock > 0" @click="tableBodyDelete(scope.$index)">售空</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
          </el-row>
        </div>
        <div v-show="active == 2">
          <el-form-item label="商品描述">
            <editor v-model="form.productDesc" :min-height="192"/>
          </el-form-item>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button style="margin-top: 12px;" @click="last" v-show="this.active > 0">上一步</el-button>
        <el-button style="margin-top: 12px;" @click="next" v-show="this.active < 2">下一步</el-button>
        <el-button type="primary" @click="submitForm" v-show="this.active == 2">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/product/info"
import {listAllBrand} from "@/api/product/brand";
import {listTreeType} from "@/api/product/type";
import {listAllRule} from "@/api/product/rule";
import index from "vuex";


export default {
  name: "Info",
  dicts: ['sys_normal_disable'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 商品信息表格数据
      infoList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: null,
        type: null,
        brand: null,
        status: null,
        keywords: null,
      },
      // 表单参数
      form: {},
      active: 0,
      // 表单校验
      rules: {
        name: [
          { required: true, message: "商品名称不能为空", trigger: "blur" }
        ],
        productDesc: [
          { required: true, message: "商品描述不能为空", trigger: "blur" }
        ],
        type: [
          { required: true, message: "商品类型不能为空", trigger: "change" }
        ],
        typeIds: [
          { required: true, message: "冗余字段不能为空", trigger: "blur" }
        ],
        img: [
          { required: true, message: "商品主图不能为空", trigger: "blur" }
        ],
        carouselImages: [
          { required: true, message: "商品轮播图不能为空", trigger: "blur" }
        ],
        brand: [
          { required: true, message: "品牌信息不能为空", trigger: "blur" }
        ],
        status: [
          { required: true, message: "商品状态不能为空", trigger: "change" }
        ],
        unit: [
          { required: true, message: "单位不能为空", trigger: "blur" }
        ],
        keywords: [
          { required: true, message: "搜索关键字不能为空", trigger: "blur" }
        ],
        ruleAttrId: [
          { required: true, message: "规格信息不能为空", trigger: "blur" }
        ],
        createBy: [
          { required: true, message: "创建人不能为空", trigger: "blur" }
        ],
        createTime: [
          { required: true, message: "创建时间不能为空", trigger: "blur" }
        ],
      },
      //存储品牌数据
      productBrandList:[],
      //商品类型树级
      productTypeListTree:[],
      //选中的值
      productTypeIds:[],
      //存储规格信息
      productRuleList:[],
      //商品sku的表头循环
      tableColumnList:[],

      //商品sku的表头模版
      tableColumnListTemplate:[
        {label:"商品库存",prop:"stock"},
        {label:"商品价格",prop:"price"},
        {label:"商品进价",prop:"purchasePrice"},
        {label:"商品售价",prop:"sellingPrice"},
        {label:"规格图片",prop:"image"},
        {label:"编号",prop:"number"},
        {label:"重量",prop:"weight"},
        {label:"体积",prop:"volume"}
      ],
      //商品sku的表格数模板
      tableBodyListTemplate:{
        "stock":0.00,
        "price":0.00,
        "purchasePrice":0.00,
        "sellingPrice":0.00,
        "image":0.00,
        "number":0.00,
        "weight":0.00,
        "volume":0.00
      },
      //商品sku统一设置数据载体
      uniteSkuForm:{
        "stock":0.00,
        "price":0.00,
        "purchasePrice":0.00,
        "sellingPrice":0.00,
        "image":'',
        "number":0.00,
        "weight":0.00,
        "volume":0.00
      }

    }
  },
  created() {
    this.getList()
    this.initBrand()
    this.initTypeTree()
    this.initProductRuleList()
  },

  methods: {
    /*
      初始化规格下拉框
    */
    initProductRuleList(){
      listAllRule().then(response=>{
        //将后端响应的数据赋值给数据模型productRuleList
        this.productRuleList = response.data || [];
        //遍历数组productRuleList
        this.productRuleList.forEach((productRule)=>{
          try {
            //获取ruleAttr并解析成数组
            let ruleAttr = JSON.parse(productRule.ruleAttr);
            let ruleTypeAttr=[];
            ruleAttr.forEach(({ruleType})=>{
              //将取出来的ruleType放到数组中
              ruleTypeAttr.push(ruleType)
            })
            productRule.name += " - " + ruleTypeAttr.toString();
          } catch (error) {
            console.error('解析规格属性失败:', error)
            productRule.name += " - 解析失败"
          }
        })
        console.log(this.productRuleList)
      }).catch(error => {
        console.error('获取规格列表失败:', error)
        this.productRuleList = []
      })
    },
    //初始化商品类型树形级列表
    initTypeTree(){
      listTreeType().then(response=>{
        this.productTypeListTree=response.data || [];
      }).catch(error => {
        console.error('获取商品类型树失败:', error)
        this.productTypeListTree = []
      })
    },
    //初始化商品品牌下拉框
    initBrand(){
      listAllBrand().then(response=>{
        this.productBrandList=response.data || [];
      }).catch(error => {
        console.error('获取商品品牌列表失败:', error)
        this.productBrandList = []
      })
    },
    //上一步
    last(){
      this.active--;
    },
    //下一步
    next(){
      let isValid = true;
      if(this.active == 0){
        //校验基本信息
        this.$refs['form'].validateField(["name","keywords","unit","status","type","brand"],
          (valid) => {
            if(!(valid == null || valid == '')){
              isValid = false;
            }
          });
      }else if(this.active == 1){
        //校验规格信息
        this.$refs['form'].validateField(["ruleAttrId"],(valid) => {
          if(!(valid == null || valid == '')){
            isValid = false;
          }
        });
      }

      if(isValid){
        this.active++;
      }
    },
    //售空
    tableBodyDelete(index){
      this.tableBodyList[index].stock=0;
    },
    //一键设置SKU属性值
    clickSettings(){
      //console.log(this.uniteSkuForm)
      this.tableBodyList.forEach((tableBody)=>{
        for(let key in this.uniteSkuForm){
          //将uniteSkuForm数组中的数据取出即表格上面的数据取出赋值给表格下面的数据
          tableBody[key]=this.uniteSkuForm[key]
        }
      })
    },
    //一键清空sku属性
    clearSettings(){
      this.uniteSkuForm={
        "stock":0.00,
        "price":0.00,
        "purchasePrice":0.00,
        "sellingPrice":0.00,
        "image":'',
        "number":0.00,
        "weight":0.00,
        "volume":0.00
      }
      this.tableBodyList.forEach((tableBody)=>{
        for (let key in this.uniteSkuForm){
          tableBody[key] =this.uniteSkuForm[key]
        }
      })
    },
    /** 查询商品信息列表 */
    getList() {
      this.loading = true
      listInfo(this.queryParams).then(response => {
        this.infoList = response.data.rows
        this.total = response.data.total
        this.loading = false
      })
    },
    //上下架
    productStatus(row){
      updateInfo({"id":row.id,"status":row.status}).then(response=>{
      this.getList()
      this.$modal.msgSuccess("修改成功")
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    changeProductTypeIds(typeIds){
      this.form.type=typeIds[typeIds.length - 1]
      this.form.typeIds=typeIds.toString()//提交form表单后端有属性接收
      console.log(this.form)
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        name: null,
        productDesc: null,
        type: null,
        typeIds: null,
        img: null,
        carouselImages: null,
        commentCount: null,
        collectCount: null,
        brand: null,
        status: null,
        unit: null,
        keywords: null,
        ruleAttrId: null,
        revision: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      }
      this.resetForm("form")
      this.active =0;
      this.tableBodyList =[];
      this.productTypeIds = [];
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm")
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = "添加商品信息"
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const id = row.id || this.ids
      getInfo(id).then(response => {
        this.form = response.data
        //console.log(this.form)
        this.productTypeIds=this.form.typeIds.split(",");
        //生成表头
        // 清空上次存储的数据
        this.tableColumnList = [];
        //保留原来的表头生成代码
        this.productRuleList.forEach(({id, ruleAttr}) => {
          if (id == this.form.ruleAttrId) {
            let ruleArr = JSON.parse(ruleAttr);
            // 遍历数组生成表头
            ruleArr.forEach(({ruleType, ruleAttrList}, index) => {
              this.tableColumnList.push({label: ruleType, prop: "prop" + index});
            });
            // 添加固定列
            this.tableColumnListTemplate.forEach(val => this.tableColumnList.push(val));
          }
        });

        let skuList = response.data.skuList;
        skuList.forEach(skuObj=>{
          //skuObj.sku = "16G,华为"
          let skuArr = skuObj.sku.split(",");
          //遍历数组skuVal = 16G,index=0;skuVal = 华为,index=1
          skuArr.forEach((skuVal,index)=>{
            skuObj["prop"+index]=skuVal;
          });
        });
        this.tableBodyList=skuList;
        this.open = true
        this.title = "修改商品信息"
      })
    },
    /**
    * 选中 规格
    * */
    changeRule(){

      // 清空上次存储的数据
      this.tableColumnList = [];
      // 规格属性二维数组
      let ruleAttrValueList = [];
      // 重置表格数据
      this.tableBodyList = [];
      //保留原来的表头生成代码
      this.productRuleList.forEach(({id, ruleAttr}) => {
        if (id == this.form.ruleAttrId) {
          try {
            let ruleArr = JSON.parse(ruleAttr);
            // 遍历数组生成表头
            ruleArr.forEach(({ruleType, ruleAttrList}, index) => {
              this.tableColumnList.push({label: ruleType, prop: "prop" + index});
              ruleAttrValueList.push(ruleAttrList);
            });
            // 添加固定列
            this.tableColumnListTemplate.forEach(val => this.tableColumnList.push(val));
          } catch (error){
            console.error('解析规格属性失败:', error)
            this.$modal.msgError('规格数据格式错误')
          }
        }
      });
      // 如果没有规格数据则返回
      if (ruleAttrValueList.length === 0) return;
      // 使用递归方式生成表格数据
      this.generateTableData(ruleAttrValueList);
      //给tableBodyList中增加属性
      this.tableBodyList.forEach((tableBody)=>{
        let sku=[];
        for (let key in tableBody){
          if (key.indexOf("prop") > -1){
            sku.push(tableBody[key])
          }
        }
        tableBody['sku']=sku.toString()
      })
    },

    generateTableData(attrValueList, currentIndex, currentData, rowIndex) {
      // 参数默认值处理
      currentIndex = typeof currentIndex !== 'undefined' ? currentIndex : 0;
      currentData = typeof currentData !== 'undefined' ? currentData : {};
      rowIndex = typeof rowIndex !== 'undefined' ? rowIndex : {value: 0};

      // 基准条件：所有规格都已处理完毕 ['8G','16G']
      if (currentIndex === attrValueList.length) {
        // 创建新行对象
        var newRow = {};

        // 复制模板数据到新行
        for (var key in this.tableBodyListTemplate) {
          if (this.tableBodyListTemplate.hasOwnProperty(key)) {
            newRow[key] = this.tableBodyListTemplate[key];
          }
        }

        // 合并当前规格组合数据
        for (var prop in currentData) {
          if (currentData.hasOwnProperty(prop)) {
            newRow[prop] = currentData[prop];
          }
        }

        // 将新行添加到表格数据中
        this.tableBodyList.push(newRow);
        rowIndex.value += 1;
        return;
      }

      // 获取当前规格的所有可选值，如['8G','16G']
      let currentValues = attrValueList[currentIndex];
      // 生成属性名，如"prop0"、"prop1"
      let propName = "prop" + currentIndex;

      // 遍历当前规格的所有可选值 currentValues = ['8G','16G']
      for (let i = 0; i < currentValues.length; i++) {
        let value = currentValues[i];// value ='8G'

        // 创建新的规格组合对象
        let newData = {};
        // 复制已有的规格数据
        for (let dataKey in currentData) {
          if (currentData.hasOwnProperty(dataKey)) {
            newData[dataKey] = currentData[dataKey];
          }
        }
        // 添加当前规格值prop0---8G
        newData[propName] = value;

        // 递归处理下一个规格
        this.generateTableData(
          attrValueList,
          currentIndex + 1,
          newData,
          rowIndex
        );
      }
    },

    /** 提交按钮 */
    submitForm() {
          this.$refs["form"].validate(valid =>{
            if (valid){
              //将this.tableBodyList
              this.form.skuList = this.tableBodyList;
              if (this.form.id != null) {
                updateInfo(this.form).then(response => {
                  this.$modal.msgSuccess("修改成功")
                  this.open = false
                  this.getList()
                })
              } else {
                addInfo(this.form).then(response => {
                  this.$modal.msgSuccess("新增成功")
                  this.open = false
                  this.getList()
                })
              }
            }
            console.log(this.tableBodyList);
          })
        },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids
      this.$modal.confirm('是否确认删除商品信息编号为"' + ids + '"的数据项？').then(function() {
        return delInfo(ids)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess("删除成功")
      }).catch(() => {})
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('product/info/export', {
        ...this.queryParams
      }, `info_${new Date().getTime()}.xlsx`)
    }
  }
}
</script>

<style scoped>
::v-deep .custom-image-uploader2 .el-upload--picture-card {
  width: 85px;
  height: 85px;
  line-height: 85px;
}

/* 调整预览图片大小 */
::v-deep .custom-image-uploader2 .el-upload-list__item {
  width: 85px;
  height: 85px;
}
/* 调整上传卡片大小 */
::v-deep .custom-image-uploader .el-upload--picture-card {
  width: 60px;
  height: 60px;
  line-height: 60px;
}

/* 调整预览图片大小 */
::v-deep .custom-image-uploader .el-upload-list__item {
  width: 60px;
  height: 60px;
}
</style>
